<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/comm_css_include.jsp"%>
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<link href="${basePath}/js/fileInput/css/fileinput.css" media="all"
	rel="stylesheet" type="text/css" />
<!doctype html>
<html>
<head>
<style type="text/css">
	    .ibox-content {
		   border: none;
	    }
	   .diepuFile-imgshowcon{
			border:1px solid #e7eaec;
			padding:15px;
			margin:0 15px;
			overflow: hidden;
			display: none;
			background-color: #fff;
		}
		
		.diepuFile-imgshowul li{
			float: left;
			margin: 15px;
			position: relative;
			width:120px;
			height: 145px;
		}
		
		.diepuFile-imgshowul li .diepuFile-img img{
			width:120px;
			height: 120px;
		}
		
		.diepuFile-layer{
			position: absolute;
			top:0px;
			height: 25px;
			width: 100%;
			padding: 3px;
			text-align: right;
		}
		
		.diepuFile-name{
			width: 100%;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			height: 25px;
			color: #000;
			text-decoration: none;
			line-height: 25px;
			text-align: center;
		}
</style>
</head>
<body class="gray-bg">
	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp; 业务受理>银行信息批量导入记录</span>
		</div>
		
		<!-- 
		<div class="iboxtitle">
			<div>共&nbsp;<label style="color: #EA2F2F;" id="fileMapsCount" name="fileMapsCount">0</label>&nbsp;个可下载文件</div>
		</div>
		 -->
		 
		<!--  
		<div class="ibox-content  ibox-zxsearchqu ibox-zxsearchqub">
			<div class="uploadfile-btn">
				<form enctype="multipart/form-data">
					<input id="uploadfile" name=uploadfile type="file" multiple class="file" data-overwrite-initial="false" data-min-file-count="1" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
				</form>
			</div>
		</div>
		-->
	</div>
	
	<!-- 下载域 -->
	<div class="diepuFile-imgshowcon">
	  	<ul class="diepuFile-imgshowul" id="diepuFileUpload">&nbsp;</ul>
	</div>
	<!-- 下载域 -->
	
	
	<!-- 列表信息 -->
	<div class="ibox-content">	
      	<div class="jqGrid_wrapper">
          <table id="table_list_1"></table>
          <div id="pager_list_1"></div>
     	</div>
    </div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>
	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>
	<script src="${basePath}/js/fileInput/js/fileinput.js" type="text/javascript"></script>
	<script src="${basePath}/js/fileInput/js/locales/zh.js" type="text/javascript"></script>

	<script  type="text/javascript">
			
			var contentEerror = '';
			contentEerror += '<div class="diepuFile-name">文件名称</div>';
			contentEerror += '<div class="diepuFile-img"><img src="${basePath}/img/xlsx.jpg"></div>';
			contentEerror += '<div class="diepuFile-name">失败(模板不正确)</div>';
	
	
			$("#uploadfile").fileinput({
			   	 language: 'zh', //设置语言
			   	 uploadUrl: "${basePath}/PublicController/uploadFile", //上传的地址(访问接口地址)
			   	 allowedFileExtensions: ['xlsx','xls','XLSX','XLS'],//接收的文件后缀
			   	 showUpload: false, //是否显示上传按钮
			   	 showRemove : false, //显示移除按钮
			   	 showPreview : false, //是否显示预览
			   	 dropZoneEnabled: false,//是否显示拖拽区域
		  	}).on("filebatchselected", function(event, files) {
		        $(this).fileinput("upload");
		    }).on("fileuploaded", function(event, datas) {
		    	if(datas.response.flag == 100100)
		    	{	 
	    		     var contentSuccess = '';
	    		     contentSuccess += '<li class="diepuFile-li" id="diepuFileUpload">';
					 contentSuccess += '<div class="diepuFile-name">'+datas.response.fileName+'</div>';
					 contentSuccess += '<div class="diepuFile-img"><img src="${basePath}/img/xlsx.jpg"></div>';
					 contentSuccess += '<div class="diepuFile-name" style="color: #366E49;">上传成功</div>';
					 contentSuccess += '</li>';
		    		 $('#diepuFileUpload').append(contentSuccess);
		    		 $('.diepuFile-imgshowcon').show();
		    		 return;
			  	}
		    	
		    	var contentErrer = '';
		    	contentErrer += '<li class="diepuFile-li" id="diepuFileUpload">';
		    	contentErrer += '<div class="diepuFile-name">'+datas.response.fileName+'</div>';
		    	contentErrer += '<div class="diepuFile-img"><img src="${basePath}/img/xlsx.jpg"></div>';
		    	contentErrer += '<div class="diepuFile-name" style="color: #DD4C40;">失败(模板不正确)</div>';
		    	contentErrer += '</li>';
	    		$('#diepuFileUpload').append(contentErrer);
	    		$('.diepuFile-imgshowcon').show();
		    }).on('fileerror', function(event, data, msg) {
		    	var contentErrer = '';
		    	contentErrer += '<li class="diepuFile-li" id="diepuFileUpload">';
		    	contentErrer += '<div class="diepuFile-name">'+msg+'</div>';
		    	contentErrer += '<div class="diepuFile-img"><img src="${basePath}/img/xlsx.jpg"></div>';
		    	contentErrer += '<div class="diepuFile-name" style="color: #DD4C40;">失败(模板不正确)</div>';
		    	contentErrer += '</li>';
	    		$('#diepuFileUpload').append(contentErrer);
	    		$('.diepuFile-imgshowcon').show();
		    }).on("fileclear",function(event, data, msg){
		    }).on("filebatchselected", function(event, files) {
		    	$('#diepuFileUpload').html("");
		    });
			
			$(function(){
				
				
				
			});
			
			var getd = function()
			{
				$.dpAjax({
	    	   		url:'${basePath}/YwShouLiController/getBankAllXlsx',
	    	   		data:{},
	    			success: function(datas){
	    		 	  if(datas.flag == "100100")
	    		 	  {
	    		 		  var fileMaps = datas.fileMaps;
	    		 		  if(fileMaps)
	    		 		  {
	    		 			 var contentSuccess = '';
	    		 			 for(var key in fileMaps)
	    		 			 {
	    		 				 contentSuccess += '<li class="diepuFile-li" id="diepuFileUpload">';
		    					 contentSuccess += '<div class="diepuFile-name">'+key+'</div>';
		    					 contentSuccess += '<div class="diepuFile-img"><img src="${basePath}/img/xlsx.jpg"></div>';
		    					 contentSuccess += '<div class="diepuFile-name" style="color: #366E49;"><a href="http://test.diepusoft.com/dpqc/file/2.xlsx">下载</a></div>';
		    					 contentSuccess += '</li>';
		    		    		 $('#diepuFileUpload').append(contentSuccess);
	    		 			 }
	    		 			 if(datas.fileMapsCount)
	    		 			 {
	    		 				$('#fileMapsCount').html(datas.fileMapsCount);
	    		 			 }
	    		    		 $('.diepuFile-imgshowcon').show();
	    		 		  }
	    				  return;
	    			  }
	    			  if(datas.flag == "100200"){
	    				  alert(JSON.stringify(datas));
	    	              return;
	    	          }
	    			  layer.msg(datas.message, {icon: 2});
	    			}
	    	   	});
			}
			
			
			var winWidth = $(window).width();
		    var winHeight = $(window).height();
			
		    $(function(){
		    	
		    	getData();
		    	
		    });
		    
			//查询数据
			var getData = function()
		    {
		       winWidth = $(window).width();
		       var winHeight = document.body.offsetHeight - 300;
		       var win = winWidth / 7 - 20;
	  	 	   $.jgrid.defaults.styleUI = 'Bootstrap';
	  	 	   
			  jQuery("#table_list_1").jqGrid
			  ({
				url:'${basePath}/DzLoanMiddleBankImportBatchController/list',
		        datatype : "json",
		        colNames : [ '主键', '银行','报表导入时间', '文件名称',  '操作人','操作'],
		        colModel : [ 
		                     {name: 'replaceId', index: '', hidden:true},
		                     {name: 'bank',index: '',width: win,align: "center"},
		                  	 {name: 'dateReceipt',index: '',width: win,align: "center"},
		               		 {name: 'fileName',index: '',width: win,align: "center"},
		               		 {name: 'creatorName',index: '',align: "center"},
		               		 {name: 'op',index: '',align: "center",formatter:function(cellvalue, options, rowObject){
		               				
		               			 return '<a href="'+rowObject.fileUrl+'">下载</a>';
		               			 
		               		 }}
		                   ],
	              mtype : "post",
	              height: winHeight,
	              autowidth: false,
	              shrinkToFit: false,
	              rowNum: 15,
	              rowList: [15, 30, 45],
	              viewrecords: true,
	              pager: "#pager_list_1",
	              hidegrid: false,
	              multiselect : false,
	              altRows:true,
			       altclass:'someClass',
	              ondblClickRow:function(rowId)
	              {
	            	  var row = $("#table_list_1").jqGrid("getRowData", rowId);
	              },
	              jsonReader : {
	            	  root:"result.rows",
	            	  page: "result.page",
	            	  total: "result.total",
	            	  records: "result.records",
	            	  repeatitems: false,
	            	  id: "replaceId"
	              },
	              loadComplete:function(datas)
	              {
	             	  if (datas.flag == "100100") 
	             	  {
	                       layer.msg("查询成功!", {icon: 6, time: 1000});
	                       return;
	                  }
	             	  if(datas.flag == '100802') {
	    				  top.location.href = thisLoginUrl;
	    				  return;
	    			  }
	             	  layer.msg(datas.message, {icon: 2});
	               }
		      });
			}	
    </script>
</body>
</html>
